# def data():
#     return [
#         ('13800000002', '123456', 200, True, 10000, '操作成功'),
#         ('13800002332', '123456', 200, False, 20001, '用户名或密码错误'),
#         ('13800000002', '123abc', 200, False, 20001, '用户名或密码错误')
#     ]
# import unittest
# import requests
# from parameterized import parameterized
# class TestLogin(unittest.TestCase):
#     @parameterized.expand(data())
#     def test01_login(self,a,b,c,d,e,f):
#         login_info = {
#             "mobile": a,
#             "password": b
#         }
#         url = "http://ihrm-test.itheima.net/api/sys/login"
#         response = requests.post(url, json=login_info)
#         print("json data =", response.json())
#         json_data = response.json()
#         self.assertEqual(c, response.status_code)
#         self.assertEqual(d, json_data.get("success"))
#         self.assertEqual(e, json_data.get("code"))
#         self.assertIn(f, json_data.get("message"))

import unittest
import requests
class ihrm_login(unittest.TestCase):
    def test_login_success(self):
        login_url='http://ihrm-test.itheima.net/api/sys/login'
        info={
            'mobile': '13800000002',
            'password': '123456'
        }
        response=requests.post(login_url,json=info)
        print(response.json())
        self.assertEqual(200,response.status_code)
        self.assertEqual(10000,response.json().get('code'))
        self.assertEqual(True, response.json().get('success'))
        self.assertIn('成功',response.json().get('message'))
        token=response.json().get('data')
        delet_url='http://ihrm-test.itheima.net/api/sys/user/121'
        headers={
            'Authorization': token
        }
        response=requests.delete(delet_url,headers=headers)
        print(response.text)








